import React, { Component } from "react";
import { Route } from "react-router-dom";

import A11 from "../pages/a/a11";

class LoaderA extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loaded: true,
      loading: null,
      A: null
    };
  }

  componentWillMount() {}

  componentDidMount() {
    import("../pages/a/a12").then((e) => {
      this.setState({
        A: e.default,
        loaded: false
      });
    });
  }

  render() {
    let { A } = this.state;
    if (this.state.loaded) {
      return <div>loading...</div>;
    }
    return <A />;
  }
}

const routes = (
  <div className="content">
    <Route exact path="/a/a11" component={A11} />
    <Route exact path="/a/a12" component={LoaderA} />
  </div>
);

export default routes;
